<div class="post">
    <div class="post_header">
        <h3 class="admin_title">Admin</h3>
    </div>
    <div class="post_content">
        Ricerca utenti

        {$openSearchUserForm}
        <table>

            <tr>
                <td>
                    {$search_user_label_username}
                </td>
                <td>
                    {$search_user_input_username}
                </td>
                <td>
                    {$search_user_submit}
                </td>
            </tr>
        </table>
        <br />
        {$closeSearchUserForm}
    </div>
    <div>
        {if isset($user_found)}
            {if $user_found == false}
                <div class="post_header">
                    <h3 class="admin_title">Utente non trovato</h3>
                </div>
            {else}
                <div class="post_header">
                    <h3 class="admin_title">Profilo di  <a style="color:blue;" href="profile.php?username={$user_found->username}">{$user_found->username}</a></h3>
                </div>
                <table>
                    <tr>
                        <td valign="top">
                            <img width="160" height="154" alt="" src="{$user_found->getAvatar()}"/>
                            {if $user_found->banned == 0}
                                <a href="admin.php?username={$user_found->username}&op=ban">Blocca utente</a><br />
                            {else}
                                <a href="admin.php?username={$user_found->username}&op=ban">Sblocca utente</a><br />
                            {/if}
                            <a href="admin.php?username={$user_found->username}&op=access">Storico accessi</a><br />
                            {if $user_found->type == 1}
                                <a href="admin.php?username={$user_found->username}&op=admin">Promuovi ad amministratore</a><br />
                            {else}
                                <a href="admin.php?username={$user_found->username}&op=rmadmin">Rimuovi amministratore</a><br />
                            {/if}
                        </td>
                        
                        <td valign="top" width="300">
                            {if isset($access)}
                                <h2 class="admin_title">Storico accessi</h2>
                                <table>
                                    <tr style="font-size:12px;">

                                        <td>
                                            <b>Data e ora</b>
                                        </td>
                                        <td>
                                            <b>Indirizzp IP</b>
                                        </td>
                                        <td>
                                            <b>ID</b>	
                                        </td>
                                    </tr>
                                    {foreach from=$access item=login name=login}

                                        <tr>

                                            <td>
                                                {Util::getDate($login->datetime)} @ {Util::getTime($login->datetime)}
                                            </td>
                                            <td>
                                                <a href="admin.php?username={$user_found->username}&op=access&ip={$login->ip_address}">{$login->ip_address}</a>
                                            </td>
                                            <td>
                                                {$login->id_login}
                                            </td>
                                        </tr>
                                    {/foreach}
                                </table>
                            {/if}
                        </td>
                        <td valign="top">
                            {if isset($users)}

                                <h2 class="admin_title">Utenti per questo IP {$ip}</h2>
                                <table>
                                    <tr style="font-size:12px;">

                                        <td>
                                            <b>Username</b>
                                        </td>
                                    </tr>
                                    {foreach from=$users item=user name=user}

                                        <tr>
                                            <td>
                                                <a href="profile.php?username={$user}">{$user}</a>
                                            </td>
                                        </tr>
                                    {/foreach}
                                </table>
                            {/if}
                        </td>
                    </tr>
                    
                </table>
            {/if}
        {/if}
    </div>   
</div>


